package com.studyshare.model;

import com.studyshare.modelBD.MessageBD;

public class Message {
		public String message;
		public String date_mess;
        public String login_dest;
        public String login_em;
		        
        public Message(String message, String d, String login_dest, String login_em) {
                super();
                this.message = message;
                date_mess = d;
                this.login_dest = login_dest;
                this.login_em = login_em;
        }
        
        public Message() {
                // TODO Auto-generated constructor stub
        }

        public static Boolean recupereMessage (String login_moi,String login_lui, MessageBD messBD){
                messBD.open();
                if(messBD.trouveMessagePersonne(login_moi, login_lui) != null){
                        messBD.toString();
                        messBD.close();
                        return true;
                }
                messBD.close();
                return false;
                
        }

        public String getMessage() {
                return message;
        }

        public void setMessage(String message) {
                this.message = message;
        }
        
        public String getLoginDest(){
                return login_dest;
        }
        public void setLoginDest(String login){
                login_dest = login;
        }
        
        public String getLoginEm(){
                return login_em;
        }
        public void setLoginEm(String login){
                login_em = login;
        }
        
        public String getDateMess(){
                return date_mess;
        }
        public void setDateMess(String d){
                date_mess = d;
        }

        public static  Boolean envoyerMessage (String message, String login_dest, String login_em, MessageBD messBD){
                messBD.open();
                
                if(messBD.envoieMessage(message, login_dest, login_em) != -1){
                        messBD.close();
                        return true;
                }
                messBD.close();
                return false;
        }        
}